<html>
<head><meta charset="utf-8"><title>feature resolver for installation · t-cargo · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/index.html">t-cargo</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/feature.20resolver.20for.20installation.html">feature resolver for installation</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216539922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/feature%20resolver%20for%20installation/near/216539922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/feature.20resolver.20for.20installation.html#216539922">(Nov 12 2020 at 22:40)</a>:</h4>
<p>With a <code>lib</code> and <code>bin</code> target described <a href="https://github.com/pksunkara/cargo-up/blob/master/cargo-up/Cargo.toml#L10-L17">here</a>, what should happen when I run <code>cargo install cargo-up --features cli --no-default-features</code>?</p>



<a name="216540023"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/feature%20resolver%20for%20installation/near/216540023" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/feature.20resolver.20for.20installation.html#216540023">(Nov 12 2020 at 22:41)</a>:</h4>
<p>I assume that only the <code>bin</code> should get installed while compiling the dependencies mentioned in <code>cli</code>. But I am getting errors saying the dependencies for the <code>lib</code> are not found.</p>



<a name="216540410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/feature%20resolver%20for%20installation/near/216540410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/feature.20resolver.20for.20installation.html#216540410">(Nov 12 2020 at 22:44)</a>:</h4>
<p><span class="user-mention" data-user-id="254853">@pksunkara</span> <code>--no-default-features</code> will prevent the <code>lib</code> feature from being enabled. That means the lib won't have access to those dependencies, and will fail to compile.  It looks like you are trying to create a <code>bin</code> that is completely independent of the package's <code>lib</code>, but I don't think that is really feasible (or at least will cause issues like this).</p>



<a name="216540591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/feature%20resolver%20for%20installation/near/216540591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/feature.20resolver.20for.20installation.html#216540591">(Nov 12 2020 at 22:46)</a>:</h4>
<p>Yeah, I am just wondering why it's not feasible. We have a clear indicator that <code>cargo install</code> is running</p>



<a name="216540616"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/feature%20resolver%20for%20installation/near/216540616" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/feature.20resolver.20for.20installation.html#216540616">(Nov 12 2020 at 22:46)</a>:</h4>
<p>so, we could try to be smart and not compile lib at all</p>



<a name="216540791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/feature%20resolver%20for%20installation/near/216540791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/feature.20resolver.20for.20installation.html#216540791">(Nov 12 2020 at 22:48)</a>:</h4>
<p>There is an implicit dependency on the library from all other targets.  You'll likely need to split it into a separate package if you don't want that implicit dependency.</p>



<a name="216540898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/feature%20resolver%20for%20installation/near/216540898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/feature.20resolver.20for.20installation.html#216540898">(Nov 12 2020 at 22:49)</a>:</h4>
<p>I will just wrap the lib code in a <code>cfg</code> and provide empty <code>lib</code> which should solve this If I am understanding correctly</p>



<a name="216541512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/feature%20resolver%20for%20installation/near/216541512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/feature.20resolver.20for.20installation.html#216541512">(Nov 12 2020 at 22:54)</a>:</h4>
<p>Adding <code>#![cfg(feature = "lib")]</code> on <code>src/lib/mod.rs</code> worked</p>



<a name="216542749"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/246057-t-cargo/topic/feature%20resolver%20for%20installation/near/216542749" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> pksunkara <a href="https://rust-lang.github.io/zulip_archive/stream/246057-t-cargo/topic/feature.20resolver.20for.20installation.html#216542749">(Nov 12 2020 at 23:09)</a>:</h4>
<p>This is related to <a href="https://github.com/rust-lang/rfcs/pull/2887">https://github.com/rust-lang/rfcs/pull/2887</a>. <span class="user-mention" data-user-id="120518">@Eric Huss</span> If you could look at and give feedback for the last comment on that, I can proceed forward and work on getting that done. Will take some load off the cargo team.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>